package com.szholly.data.general.metadata.table;

import com.szholly.data.general.GlobalDataType;
import com.szholly.data.general.RowBase;
import com.szholly.data.general.WorkspaceType;

/**
 * 类功能说明 定义数据连接实体
 */
public class ConnectionRow extends RowBase {

	/**
	 * 
	 */
	private static final long serialVersionUID = 4891124367340044578L;

	/**
	 * 连接ID
	 */
	public final static String FIELD_CONNECTIONID = "S_CONNECTIONID";

	/**
	 * 连接名称
	 */
	public final static String FIELD_CONNECTIONNAME = "S_CONNECTIONNAME";

	/**
	 * 资源类型
	 */
	public final static String FIELD_DATABASETYPE = "I_DATABASETYPE";

	/**
	 * 数据库连接字符串
	 */
	public final static String FIELD_CONNECTIONSTR = "S_CONNECTIONSTR";

	/**
	 * @Title: getConnectionID
	 * @Description: 连接ID
	 * @param @return
	 * @return String 返回类型
	 * @throws
	 */
	public String getConnectionID() {
		Object obj = getValue(GlobalDataType.String, FIELD_CONNECTIONID);
		return (String) obj;
	}

	public void setConnectionID(String value) {
		setValue(FIELD_CONNECTIONID, value);
	}

	/**
	 * @Title: getConnectionName
	 * @Description: 连接名称
	 * @param @return
	 * @return String 返回类型
	 * @throws
	 */
	public String getConnectionName() {
		return (String) getValue(GlobalDataType.String, FIELD_CONNECTIONNAME);
	}

	public void setConnectionName(String value) {
		setValue(FIELD_CONNECTIONNAME, value);
	}

	/**
	 * @Title: getDataBaseType
	 * @Description: 资源类型
	 * @param @return
	 * @return WorkspaceType 返回类型
	 * @throws
	 */
	public WorkspaceType getDataBaseType() {
		Object obj = getValue(GlobalDataType.Int32, FIELD_DATABASETYPE);
		if (obj instanceof Integer) {
			Integer bigD = (Integer) obj;
			return WorkspaceType.getWorkspaceTypeByTypeId(bigD.intValue());
		} else {
			return WorkspaceType.Oracle;
		}
	}

	public void setDataBaseType(WorkspaceType value) {
		setValue(FIELD_DATABASETYPE, value.getWorkspaceType());
	}

	/**
	 * @Title: getConnectionStr
	 * @Description: 数据库连接字符串
	 * @param @return
	 * @return String 返回类型
	 * @throws
	 */
	public String getConnectionStr() {
		return (String) getValue(GlobalDataType.String, FIELD_CONNECTIONSTR);

	}

	public void setConnectionStr(String value) {
		setValue(FIELD_CONNECTIONSTR, value);
	}

}
